{$i outputchar.inc}

Function fpc_get_input:PText;compilerproc;
begin
	result := nil;
end;

Function fpc_get_output:PText;compilerproc;
begin
	result := nil;
end;

Procedure fpc_Write_End(var f:Text); compilerproc;
begin
end;

Procedure fpc_Writeln_End(var f:Text); compilerproc;
begin
	putchar(#13);
	putchar(#10);
end;

Procedure fpc_Write_Text_ShortStr(Len : Longint;var f : Text;const s : String); compilerproc;
var i: longint;
begin
	for i := 1 to length(s) do
		putchar(s[i]);
end;

Procedure fpc_Write_Text_Pchar_as_Array(Len : Longint;var f : Text;const s : array of char; zerobased: boolean = true); compilerproc;
var i: longint;
begin
	if zerobased then
	begin
		for i := 0 to high(s) do
			putchar(s[i]);
	end
	else
	begin
		for i := 1 to length(s) do
			putchar(s[i]);
	end;
end;

Procedure fpc_Write_Text_PChar_As_Pointer(Len : Longint;var f : Text;p : PChar); compilerproc;
begin
	if p = nil then
		exit;
	
	while p^ <> #0 do
	begin
		putchar(p^);
		inc(p);
	end;
end;

Procedure fpc_Write_Text_AnsiStr (Len : Longint; Var f : Text; const S : AnsiString); compilerproc;
var i: longint;
begin
	for i := 1 to length(s) do
		putchar(s[i]);
end;

Procedure fpc_Write_Text_Char(Len : Longint;var t : Text;c : Char); compilerproc;
begin
	putchar(c);
end;

Procedure fpc_Write_Text_SInt(Len : Longint;var t : Text;l : PtrInt); compilerproc;
begin
	if l < 0 then
	begin
		write('-');
		l := -l;
	end;
	
	fpc_Write_Text_UInt(len, t, l);
end;

Procedure fpc_Write_Text_UInt(Len : Longint;var t : Text;l : PtrUInt); compilerproc;
var buf: array[0..11] of char;
	 p: longint;
begin
	if l = 0 then
		putchar('0')
	else
	begin
		p := high(buf);
		buf[p] := #0;
		while l > 0 do
		begin
			dec(p);
			buf[p] := char((l mod 10)+byte('0'));
			l := l div 10;
		end;
		
		write(pchar(@buf[p]));
	end;
end;

procedure fpc_write_text_qword(len : longint;var t : text;q : qword); compilerproc;
var buf: array[0..19] of char;
	 p: longint;
begin
	if q = 0 then
		putchar('0')
	else
	begin
		p := high(buf);
		buf[p] := #0;
		while q > 0 do
		begin
			dec(p);
			buf[p] := char((q mod 10)+byte('0'));
			q := q div 10;
		end;
		
		write(pchar(@buf[p]));
	end;
end;

procedure fpc_write_text_int64(len : longint;var t : text;i : int64); compilerproc;
begin
	if i < 0 then
	begin
		write('-');
		i := -i;
	end;
	
	write(qword(i));
end;

Procedure fpc_Write_Text_Boolean(Len : Longint;var t : Text;b : Boolean); compilerproc;
begin
	if b then
		write('true')
	else
		write('false');
end;